object work3 {
    def main(args: Array[String]): Unit = {
    class a {
      def addOne(list: List[Int]): List[Int] = list.map(_ + 1)
      def filterEven(list: List[Int]): List[Int] = list.filter(_ % 2 == 0)
      def mapReduce(list: List[Int])( b: Int => Int)( c: (Int, Int) => Int): Int = {
        list.map(b).reduce(c)
      }
    }

    val a1 = new a()
    val list = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
    val addOneList = a1.addOne(list)
    println(addOneList) //输出List(2，3，4，5，6，7，8，9，10，11
    val evenList = a1.filterEven(list)
    println(evenList) //输出List(2，4，6，8，10)
    val sum = a1.mapReduce(list)(x => x * 2)(_ + _)
    println(sum) //输出110




  }
}